import request from '@/utils/request'

export async function login(username, password) {
  // let res = await request({
  //   url: '/login',
  //   method: 'get',
  //   params: {
  //       number:  username,
  //       password: password
  //   }
  // })
  // console.log(res.data);
  // return res.data;
  return new Promise(async(resolve, reject) => {
    if (username === 'admin' && password === '123') {
      resolve({ role: 'admin', token: 1, username: 'admin', password: 'admin' })
    } else if (username === 'user' && password === '123') {
      resolve({ role: 'user', token: 2, username: 'user', password: '123' })
    } else {
      resolve({ })
    }
  })
}

export function logout() {
  // return request({
  //   url: '/user/logout',
  //   method: 'post'
  // })
  return new Promise(async(resolve, reject) => {
    resolve()
  })
}
